<%@ page contentType= "text/html;charset=gb2312" %>

<html>
<%@ include file="../common/base.jsp" %>

<head>
<style type="text/css" media="print">
.noprint	{display : none }
.PageNext	{page-break-after: always }
</style>
</head>

<script type="text/javascript" src="../styles/date/WdatePicker.js">
</script>

<body>

<script language="javascript">
function iniAssembly(){
	document.getElementById("title_assembly").style.display = "block";
	document.getElementById("title_testing").style.display = "none";
	document.getElementById("title_datasheet").style.display = "none";
	if(document.getElementById("table_assembly"))
		document.getElementById("table_assembly").style.display = "block";
	if(document.getElementById("table_testing"))
		document.getElementById("table_testing").style.display = "none";
	if(document.getElementById("table_datasheet"))
		document.getElementById("table_datasheet").style.display = "none";
	if(document.getElementById("td_product"))
		document.getElementById("td_product").style.display = "block";
}

function iniTesting(){
	document.getElementById("title_assembly").style.display = "none";
	document.getElementById("title_testing").style.display = "block";
	document.getElementById("title_datasheet").style.display = "none";
	if(document.getElementById("table_assembly"))
		document.getElementById("table_assembly").style.display = "none";
	if(document.getElementById("table_testing"))
		document.getElementById("table_testing").style.display = "block";
	if(document.getElementById("table_datasheet"))
		document.getElementById("table_datasheet").style.display = "none";
	if(document.getElementById("td_product"))
		document.getElementById("td_product").style.display = "block";
}

function iniDataSheet(){
	document.getElementById("title_assembly").style.display = "none";
	document.getElementById("title_testing").style.display = "none";
	document.getElementById("title_datasheet").style.display = "block";
	if(document.getElementById("table_assembly"))
		document.getElementById("table_assembly").style.display = "none";
	if(document.getElementById("table_testing"))
		document.getElementById("table_testing").style.display = "none";
	if(document.getElementById("table_datasheet"))
		document.getElementById("table_datasheet").style.display = "block";
	if(document.getElementById("td_product"))
		document.getElementById("td_product").style.display = "none";
}

function onPrint(){
	var code="<body onload=window.print()>"
	code+=document.all.process_details.innerHTML;
  	//code=code.toUpperCase();
  	//code=code.replace(/<A[^>]*>删除</A>/gi, "");
  	//code=code.toLowerCase();
  	var newwin=window.open('','','');
  	newwin.opener = null;
  	newwin.document.write(code);
  	newwin.document.close();
}

</script>

<div id="container">
<%@ include file="../common/header.jsp" %>
<script language="javascript">
document.getElementById('div_lang').style.display = "none";
</script>

	<div id="menu">
		<a href="<c:url value="/common/home.o"/>"><fmt:message key="Home" /></a> > 
	    <a href="<c:url value="/template/manage.o"/>"><fmt:message key="Template" /></a> >
	    <fmt:message key="Preview" />
		<div  style="float: right" ><fmt:message key="Logged" />: <c:out value="${currentUser.username}" /> (<a href="<c:url value="/common/logout.o"/>"><fmt:message key="Logout" /></a>)</div>
	</div>
	
	<div id="midbody">
	    <div id="leftside">
			<br>
		   	<a href="<c:url value="/template/manage.o"/>"><fmt:message key="AllTemplate" /></a>
		   	<br><br>
		   	<a href="<c:url value="/template/create.o"/>"><fmt:message key="CreateTemplate" /></a>
		</div>
	    <div id="rightside">
	
			<div id="bigbox">
			    <div class="title clearfix">
				    <div style="float: left">
				    	<c:out value="${product.template.name}" />
				    </div>
				    <%@ include file="../common/hidemenu.jsp" %>
			    </div>
			
			    <div id="process_details" class="content">
	
					<form action="./index.o" method="post">
					<c:forEach var="error" items="${errors}">
						<div style="color:red"><fmt:message key="${error.code}" /></div>
					</c:forEach>
					<input type="hidden" name="productId" value="<c:out value="${product.id}" />">
					<input type="hidden" name="processId" value="<c:out value="${product.processId}" />">
					<input type="hidden" name="status" value="<c:out value="${product.status}" />">
					<table width="100%">
						<tr>
							<td>
								<div id="title_assembly"><h3>DWDM Sub-Assembly Tab ( 组装 )</h3></div>
								<div id="title_testing"><h3>DWDM Single Device Traveler Card ( 测试 )</h3></div>
								<div id="title_datasheet"><h3>DWDM Final Test Data Report</h3></div>
							</td>
							<td align="right" class="noprint">
								<c:if test="${not empty View}">
									<input id="switch_assembly" type="radio" name="switch" value="Assembly" onchange="iniAssembly();" checked>组装
									<input id="switch_testing" type="radio" name="switch" value="Testing" onchange="iniTesting();">测试
									<input id="switch_datasheet" type="radio" name="switch" value="DataSheet" onchange="iniDataSheet();">DataSheet
									<script language="javascript">
									iniAssembly();
									</script>
								</c:if>
							</td>
						</tr>
						<tr>
							<td id="td_product" align="center" width="100%" colspan="2">
								<jsp:include page="../step/product.jsp"/>
							</td>
						</tr>
					</table>
					<table id="table_assembly" width="100%">
						<c:if test="${not empty product.step10_1Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step10.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step20Datas 
										|| not empty product.step30_1Datas 
										|| not empty product.step30_2Datas 
										|| not empty product.step40Datas 
										|| not empty product.step50Datas 
										|| not empty product.step60Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step20-60.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step70Datas 
										|| not empty product.step80Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step70-80.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step90Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step90.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step100_1Datas 
										|| not empty product.step100_2Datas 
										|| not empty product.step100_3Datas}">
						<tr height="10px">
						</tr>
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step100.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step110Datas}">
						<tr height="10px">
						</tr>
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step110.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step120_1Datas 
										|| not empty product.step120_2Datas}">
						<tr height="10px">
						</tr>
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step120.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step130Datas}">
						<tr height="10px">
						</tr>
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step130.jsp"/>
							</td>
						</tr>
						</c:if>
					</table>
					<table id="table_testing" width="100%" style="display:none;">
						<c:if test="${not empty product.step140_1Datas 
										|| not empty product.step140_2Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step140.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step150Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step150.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step160Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step160.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step170_1Datas 
										|| not empty product.step170_2Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step170.jsp"/>
							</td>
						</tr>
						</c:if>
						<c:if test="${not empty product.step180Datas}">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/step180.jsp"/>
							</td>
						</tr>
						</c:if>
					</table>
					<table id="table_datasheet" width="100%" style="display:none;">
						<tr>
							<td align="center" width="100%">
								<jsp:include page="../step/datasheet.jsp"/>
							</td>
						</tr>
					</table>
					</form>
			    </div>
				<table width="100%">
					<tr>
						<td align="center" width="100%">
							<input type="button" value="<fmt:message key='Print' />" onclick="onPrint();">
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<%@ include file="../common/foot.jsp" %>
</div>

</body>
</html>
